<%--
  Created by IntelliJ IDEA.
  User: 惠普
  Date: 2020/6/4
  Time: 8:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="true" %>
<html>
<head>
    <title>退货申请处理</title>
    <%@include file="/common/header.jsp"%>
</head>
<body>
<div id="root">
    <Collapse>
        <Panel name="1">
            条件查询
            <p slot="content">
                <i-form :label-width="100" inline>
                    <Form-Item label="服务单号">
                        <i-input type="text" clearable v-model="ReturnGoods.id" placeholder="请输入"></i-input>
                    </Form-Item>
                    <Form-Item label="用户账号">
                        <i-input type="text" clearable v-model="ReturnGoods.userCode" placeholder="请输入"></i-input>
                    </Form-Item>
                    <Form-Item label="申请状态">
                        <i-Select v-model="ReturnGoods.state" clearable  style="width: 120px;">
                            <i-Option v-for="item in stateList" :value="item.value" :key="item.value">{{ item.label }}</i-Option>
                        </i-Select>
                    </Form-Item>
                    <Form-Item label="申请时间:">
                        <Date-Picker type="date" placeholder="申请时间" style="width: 190px" v-model="ReturnGoods.applicationTime" @on-change="ReturnGoods.applicationTime=$event"></Date-Picker>
                    </Form-Item>
                    <Form-Item label="处理时间:">
                        <Date-Picker type="date" placeholder="处理时间" style="width: 190px" v-model="ReturnGoods.processingTime" @on-change="ReturnGoods.processingTime=$event"></Date-Picker>
                    </Form-Item>
                    <i-button type="default" @click="pageNo=1;getReturnsList();">搜索</i-button>
                </i-form>
            </p>
        </Panel>
    </Collapse>
    <Card style="margin: 20px 0" >
        <Icon type="ios-film-outline"></Icon>
        数据列表
    </Card>
    <i-table :columns="column" :data="data" @on-selection-change="tableSelect=arguments[0]" border stripe height="400">
        <template slot-scope="scope" slot="state">
            {{ scope.row.state === 0 ? '已拒绝':(scope.row.state ===1 ? '待处理':(scope.row.state ===2 ? '退货中':(scope.row.state===3 ? '已完成':'以取消')))}}
        </template>
        <template slot-scope="{row,index}" slot="orderItemId">
            ￥{{row.orderItem.productPrice}}
        </template>
        <template slot-scope="scope" slot="processingTime">
           {{scope.row.processingTime === null ?'N/A':scope.row.processingTime}}
        </template>
        <template slot-scope="scope" slot="cishu">
            {{3-scope.row.cishu}}
        </template>
        <template slot-scope="{row,index}" slot="action">
            <i-button type="default"  @click="view(row)">查看详情</i-button>
        </template>
    </i-table>
    <%--<i-button type="default" @click="pdel" style="margin-left: 20px;margin-top: 20px">批量删除</i-button>--%>
    <template>
        <Page :total="total1"
              :page-size="pageSize"
              :current.sync="pageNo"
              show-total
              show-sizer
              :page-size-opts="[5,10,15,20]"
              style="margin-left: 30%;"
              @on-page-size-change="pageSize=arguments[0];getReturnsList();"
              @on-change="getReturnsList"/>
    </template>
</div>
</body>
<script>
    new Vue({
        el:"#root",
        data:{
            column:[
                // {
                //     type: "selection",
                //     width: 60,
                //     align: "center"
                // },
                {title:"服务单号",key:"id"},
                {title:"申请时间",key:"applicationTime"},
                {title:"用户账号",key:"userCode"},
                {title:"退款金额",slot:"orderItemId"},
                {title:"申请状态",slot:"state"},
                {title:"处理时间",slot:"processingTime"},
                {title:"剩余申请次数",slot:"cishu"},
                {title:"操作",slot:"action"}
            ],
            stateList:[
                {
                    value: '0',
                    label: '已拒绝'
                },
                {
                    value: '1',
                    label: '待处理'
                },
                {
                    value: '2',
                    label: '退货中'
                },
                {
                    value: '3',
                    label: '已完成'
                },
                {
                    value: '4',
                    label: '已取消'
                },
            ],
            data:[],
            ReturnGoods:{},
            total1:{},
            pageSize:10,
            pageNo:1,
            userList:[],
            tableSelect:[]
        },
        mounted(){
            this.getReturnsList();
        },
        methods:{
            getReturnsList(){
               axios.post(`/ord/apply/list/${this.pageNo}/${this.pageSize}`,this.ReturnGoods)
                   .then(({data})=>{
                       this.data=data.result.list;
                       this.total1 = data.result.total
                   })
           },
            view(row){
                window.location.href="/ord/apply/view?id="+row.orderItemId+"&"+"cid="+row.id;
            }
            // 批量删除
            <%--pdel(){--%>
                <%--if(this.tableSelect.length==0){--%>
                    <%--iview.Modal.confirm({--%>
                        <%--title:"信息提示",--%>
                        <%--content:"请选择删除对象！"--%>
                    <%--})--%>
                    <%--return;--%>
                <%--}--%>
                <%--let _this = this;--%>
                <%--let a = this.tableSelect.map(node=>"id="+node.id).join("&");--%>
                <%--iview.Modal.confirm({--%>
                    <%--title:"您确定要删除吗？",--%>
                    <%--content:"此操作是不可逆的",--%>
                    <%--onOk(){--%>
                        <%--axios.get(`/ord/apply/pdel?${a}`).then(--%>
                            <%--({data})=>{--%>
                                <%--iview.Message.success({content:data.msg});--%>
                                <%--_this.getReturnsList()--%>
                            <%--}--%>
                        <%--)--%>
                    <%--},--%>
                    <%--onCancel(){--%>
                        <%--iview.Message.info("取消")--%>
                    <%--}--%>
                <%--})--%>
            <%--}--%>


        }


    })
</script>
</html>
